package com.jucai.pppeiyouclient.view.dialog;

import android.content.Context;
import android.text.Selection;
import android.view.View;
import android.widget.EditText;

import com.jucai.pppeiyouclient.R;
import com.jucai.pppeiyouclient.base.BaseDialog;
import com.jucai.pppeiyouclient.comm.CommonMethod;

/**
 * Created by Kuky on 2017-05-06.
 */

public class Balance2CoinDialog extends BaseDialog {
    private View dialogView;
    private EditText coinSum;

    public String getCoinSum() {
        return coinSum.getText().toString();
    }

    public Balance2CoinDialog(Context context) {
        super(context);
    }

    public Balance2CoinDialog(Context context, int themeResId) {
        super(context, themeResId);
    }

    protected Balance2CoinDialog(Context context, boolean cancelable, OnCancelListener cancelListener) {
        super(context, cancelable, cancelListener);
    }

    @Override
    protected View initView() {
        dialogView = CommonMethod.getView(context, R.layout.dialog_balance_2_coin);
        coinSum = (EditText) dialogView.findViewById(R.id.dialog_coin_sum);
        Selection.setSelection(coinSum.getText(), coinSum.getText().length());
        return dialogView;
    }

    @Override
    public void setOnclickListener(View.OnClickListener listener) {
        dialogView.findViewById(R.id.dialog_coin_minus).setOnClickListener(listener);
        dialogView.findViewById(R.id.dialog_coin_add).setOnClickListener(listener);
        dialogView.findViewById(R.id.dialog_sure_change).setOnClickListener(listener);
        dialogView.findViewById(R.id.dialog_cancel_change).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                dismiss();
            }
        });
    }
}
